package com.szh.mysobproject.ui.activity

import by.kirich1409.viewbindingdelegate.viewBinding
import com.hjq.base.FragmentPagerAdapter
import com.szh.mysobproject.R
import com.szh.mysobproject.app.AppActivity
import com.szh.mysobproject.app.AppFragment
import com.szh.mysobproject.databinding.VipActivityBinding
import com.szh.mysobproject.ui.fragment.VipIntroFragment
import com.szh.mysobproject.ui.fragment.VipListFragment
import com.szh.mysobproject.util.clearTooltipText

class VipActivity : AppActivity() {

    private val mBinding: VipActivityBinding by viewBinding()

    private lateinit var mFragmentAdapter: FragmentPagerAdapter<AppFragment<*>>

    override fun getLayoutId(): Int = R.layout.vip_activity

    override fun initView() {
        mBinding.tabLayout.setupWithViewPager(mBinding.viewPager)

    }

    override fun initData() {
        mFragmentAdapter = FragmentPagerAdapter<AppFragment<*>>(this)
        mFragmentAdapter.addFragment(VipIntroFragment.newInstance(), "特权介绍")
        mFragmentAdapter.addFragment(VipListFragment.newInstance(),"贵宾席")
        mBinding.viewPager.adapter = mFragmentAdapter
        mBinding.tabLayout.clearTooltipText()
    }

    override fun onDestroy() {
        super.onDestroy()
        mBinding.viewPager.adapter = null
    }
}